<!DOCTYPE html>
<html>
	<head>
	<meta charset="utf-8" />
	<meta name="author" content="Liang wei">
    <meta name="viewport" content="width= device-width , user-scalable=no,initial-scale=1.0" />
	<link rel="stylesheet" href="css/header.css" />
	<link rel="stylesheet" href="css/lunbo.css" />
	<link rel="stylesheet"  href="css/base.css"/>
	<link rel="stylesheet" href="css/index.css" />
	<script type="text/javascript" src="js/lunbo.js" ></script>
	<script type="text/javascript" src="js/jquery-3.1.1.js" ></script>
	<script type="text/javascript" src="js/vue.js" ></script>
	<link rel="stylesheet" href="css/footer.css" />
	
	<style>
		  <div style="width: 100%; height: 10rem;">
	        <div style="margin: auto; width: 100%; height: 10rem; text-align: center;">
	</style>
	</head>
	<body>
		<div>
		<div>
		<header>
				<img src="img/logo.png"  />
				<form class="search" action="">
					<input class="search_text" type="text" placeholder="搜索" />
				</form>				
		</header>
		
		
    <div style="width: 100%; height: 10rem; margin-top: 30px;">
	 <div style="margin: auto; width: 100%; height: 10rem; text-align: center;">
	    <form>
         <input id="imginput"  type="file" accept="image/*" />
        </form>

       <label for="img_input" id="img_label"></label>
       <button class="btn_qd" onclick="edit_photo()">确定修改</button>
	     
	  </div>
	</div>
			
			
		
     
	
	<!--尾栏-->
	<div class="footer_box">
		
	  <a href="train2.html"><img src="img/步数.png"/>训练</a>     
      <a href="club.html"><img src="img/运动.png"/>俱乐部</a>
      <a href="index.html"><img src="img/设备.png"/>约建</a>
      <a href="showpicture.html"><img src="img/活动.png"/>晒图</a>   
      <a href="wode.html"><img src="img/首页.png"/>我的</a>
  </div>


	<script type="text/javascript" src="js/common.js" ></script>	
	<script>
		  
	  function edit_photo() {	
	  	var userid = localStorage.getItem('userid');
        var formdate=new FormData();
        var imgname=document.getElementById("imginput");
        var imginfor=imgname.files[0];
 
        formdate.append("photo",imginfor);
        console.log(formdate);

       $.ajax({
           url: "http://172.24.10.175/workout/api.php/fuserphoto/userid/"+userid,
           type: 'POST',

           cache: false,
           processData: false,
           contentType: false,

            data:formdate,
	        success :function (){  
	                alert("上传成功");  
	                
	           },
           error: function(){

           }
       });
   }
		
		
		
		
		
	
	</script>	
	</body>

</html>
